import React from 'react';
import { Form, Input } from 'antd';
const { TextArea } = Input;

interface SummaryTextareaProps {
    name: string;
    label: string;
    required: boolean;
    onBlur: (value: string) => void;
}

const SummaryTextarea = (props: SummaryTextareaProps) => {
    const { name, label, required, onBlur } = props;

    const handleBlur = (e: any) => {
        onBlur(e.target.value)
    };

    return (
        <Form.Item label={label} name={name} required={required} rules={[{ required: required, message: `请输入${label}` }]}>
            <TextArea
                required={required}
                autoSize={{ minRows: 2, maxRows: 4 }}
                onBlur={handleBlur}
            />
        </Form.Item>
    );
};

export default SummaryTextarea;